import request from '@/utils/request'

// 单文件上传
export const uploadFile = (formData) => {
  return request({
    url: '/api/file/upload',
    method: 'post',
    data: formData,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

// 多文件上传
export const uploadFiles = (formData) => {
  return request({
    url: '/api/file/upload/batch',
    method: 'post',
    data: formData,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

// 获取文件列表
export const getFileList = (params, silent = false) => {
  return request({
    url: '/api/file/list',
    method: 'get',
    params,
    silent
  })
}

// 删除文件
export const deleteFile = (fileId) => {
  return request({
    url: `/api/file/delete/${fileId}`,
    method: 'delete'
  })
}

// 获取文件信息
export const getFileInfo = (fileId) => {
  return request({
    url: `/api/file/info/${fileId}`,
    method: 'get'
  })
}




